package com.itcs.app.controller;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import com.itcs.app.tran.Send2ClearThread;
import com.itcs.redis.queue.RedisQueueTemplate;
import com.itcs.trading.mapper.TransJournalMapper;
import com.itcs.trading.model.TransJournal;

@Controller
@RequestMapping("/clear")
public class SendQueueController {

	private ExecutorService executorService = Executors.newFixedThreadPool(10);

	@Autowired
	private RedisQueueTemplate redisQueueTemplate;

	@Autowired
	private TransJournalMapper transJournalMapper;

	@RequestMapping(value = "/sendjnl")
	public void sendMsg(HttpServletRequest request, HttpServletResponse response) {
		String transacSeq = request.getParameter("transacSeq");
		if (StringUtils.isEmpty(transacSeq)) {
			transacSeq = "G450111001002030101202018020410301400";
		}
//		TransJournal etcsTraderecord = transJournalMapper.selectByPrimaryKey(transacSeq);

//		Send2ClearThread send2ClearThread = new Send2ClearThread(redisQueueTemplate, etcsTraderecord);
//		executorService.execute(send2ClearThread);
	}
}
